package com.atguigu.spring.tx.xml.service.impl;

import com.atguigu.spring.tx.xml.service.BookService;
import com.atguigu.spring.tx.xml.service.CheckOutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author wk
 * @create 2021-06-04 9:18
 */
@Service
public class CheckOutServiceImpl implements CheckOutService {

    @Autowired
    private BookService bookService;

    @Override
    public void checkout(int userId, int[] bookIds) {
        for (int bookId : bookIds) {
            bookService.buyBook(userId, bookId);
        }
    }
}
